{% extends "base.html" %}

{% block css_js %}
    <!--DataTables [ OPTIONAL ]-->
    <link href="/static/plugins/datatables/media/css/dataTables.bootstrap.css" rel="stylesheet">
	<link href="/static/plugins/datatables/extensions/Responsive/css/dataTables.responsive.css" rel="stylesheet">


   <!--DataTables [ OPTIONAL ]-->
    <script src="/static/plugins/datatables/media/js/jquery.dataTables.js"></script>
	<script src="/static/plugins/datatables/media/js/dataTables.bootstrap.js"></script>
	<script src="/static/plugins/datatables/extensions/Responsive/js/dataTables.responsive.min.js"></script>


    <!--DataTables Sample [ SAMPLE ]-->
    <script src="/static/js/cmdb/tables-datatables.js"></script>
{% endblock %}

{% block active-link-li-2 %}
    class="active-link"
{% endblock %}

{% block content-container %}
    <!--Page Title-->
    <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
    <div id="page-title">
        <h1 class="page-header text-overflow">主机列表</h1>
    </div>
    <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
    <!--End page title-->

    <!--Page content-->
    <!--===================================================-->
    <div id="page-content">

        <div class="panel">
            <div class="panel-heading">
                <h3 class="panel-title">包含：物理主机 | ECS云服务器 | KVM虚拟机</h3>
            </div>
            <div class="panel-body">
                <table id="demo-dt-basic" class="table table-striped table-bordered" cellspacing="0" width="100%">
                    <thead>
                        <tr>
                            <th>实例名</th>
                            <th>IP地址</th>
                            <th class="min-tablet">资产类型</th>
                            <th class="min-tablet">描述</th>
                            <th class="min-desktop">状态</th>
                            <th class="min-desktop">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for host in msg.allhost %}
                            <tr>
                                <td>{{ host.hostinstancename }}</td>
                                <td>{{ host.hostipaddr }}</td>
                                {% if host.hosttype == 1 %}
                                    <td>物理机</td>
                                {% elif host.hosttype == 2 %}
                                    <td>ECS</td>
                                {% elif host.hosttype == 3 %}
                                    <td>KVM</td>
                                {% endif %}
                                <td>{{ host.hostdesc }}</td>
                                {% if host.hoststatus == 1 %}
                                    <td style="color: green">上线</td>
                                {% elif host.hoststatus == 2 %}
                                    <td style="color: red">下线</td>
                                {% endif %}
                                <td>
                                    <a class="btn btn-warning btn-xs" href="/hostedit_{{ host.hostname }}/">编辑</a>
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>

    </div>
    <!--===================================================-->
    <!--End page content-->
{% endblock %}
